package com.example.qimo;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.nfc.Tag;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import android.widget.TextView;

import androidx.annotation.NonNull;

import java.io.InputStream;
import java.util.ArrayList;

public class Myadapter extends ArrayAdapter {
    private static final String Tag= "myadpter";
    public Myadapter(@NonNull Context context, int resource, ArrayList<item> list) {
        super(context, resource, list);
    }
    public View getView(int position, View convertView, ViewGroup parent){
        View itemView = convertView;
        if(itemView==null)
        {
            itemView= LayoutInflater.from(getContext()).inflate(R.layout.allnote_item,
                    parent,false);
        }
//       Map<String,String> map = (Map<String,String>)getItem(position);
        Log.i(Tag,"what"+position);
        item item = (item)getItem(position);
        TextView title = itemView.findViewById(R.id.itemTitle);
        TextView detail = itemView.findViewById(R.id.itemDetail);
        TextView time = itemView.findViewById(R.id.timelist);
        title.setText(Html.fromHtml(item.getTitle()));
        Log.i(Tag,"what"+title.toString());
        detail.setText(item.getText());
        Log.i(Tag,"what"+detail.toString());
        time.setText(item.getTime());
        Log.i(Tag,"what"+time.toString());

        return itemView;

    }

}

